﻿@model List<Model.TextModel>

@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Index</title>
    <style type="text/css">
      #gotop {
            display: none;
            width: 55px;
             height: 55px;
             position: fixed;
             right: 50px;
             bottom: 50px;
           background: url(img/1.png) no-repeat -70px 0px;
        }
    </style>

</head>
<body>

    <div class="container">
        <div class="row">
            <header class="page-header">
                <h1 class="page-title">答题卡</h1>

            </header>
            @using (Html.BeginForm("DataTableToExcel", "Text", FormMethod.Post))
            {
                <table>
                    <tr><td></td></tr>
                    <tr>
                        <td>@Html.Hidden("strGUID")</td>
                        <td>
                            <input id="Button1" type="button" value="全选" />&nbsp;&nbsp;
                            &nbsp;&nbsp;<input type="submit" value="导出" onclick="selectExcel()" />
                        </td>
                    </tr>
                </table>
            }

            @foreach (var item in Model)
            {
                <!-- Article main content -->
                <article class="col-sm-9 maincontent">


                    <p>
                        <input type="checkbox" name="check" id="ck" value="@item.Tid" /> @item.TName
                    </p>
                    <br>
                    <!--NOTE: Update your email Id in "contact_me.php" file in order to receive emails from your contact form-->
                   



                        <div class="control-group">
                            <div class="controls">
                                <textarea rows="10" cols="100" class="form-control"
                                          placeholder="请输入您的答案" id="message" required
                                          data-validation-required-message="Please enter your message" 
                                          data-validation-minlength-message="Min 5 characters"
                                          maxlength="999" style="resize:none"></textarea>
                            </div>
                        </div>
                        <div id="success"> </div> <!-- For success/fail messages -->

                   

                </article>
            }
            <!-- /Article -->


        </div>
        <br />

        <div class="col-sm-9 maincontent">
            <button type="button" class="btn btn-primary pull-right" onclick="sub()">提交</button>
        </div>
    </div>
    <div id="h" hidden="hidden" class="container">

        @foreach (var item in Model)
        {

            <label style="color:red">题目</label> @item.TName <br />
            <label style="color:red">答案</label> @item.TAnswer<br /><br />
        }



    </div>
    
    <div id="gotop">
     <img src="~/img/5-1304121QA4.gif" />
    </div>
    <br />
    <br />

    <footer id="footer">

        <div class="footer1">
            <div class="container">
                <div class="row">
                    <div class="col-md-5 panel">
                        <h3 class="panel-title">要努力</h3>
                        <div class="panel-body">
                            <p>在别人肆意说你的时候，问问自己，到底怕不怕，输不输的起。不必害怕，不要后退，不须犹豫，难过的时候就一个人去看看这世界。多问问自己，你是不是已经为了梦想而竭尽全力了？</p>
                        </div>
                    </div>

                    <div class="col-md-4 panel contact">
                        <h3 class="panel-title">
                            座右铭
                        </h3>
                        <div class="panel-body">
                            <p>
                                天将降大任于是人也，必先苦其心志，劳其筋骨，饿其体肤，空乏其身，行拂乱其所为。
                                ——《孟子?告子下》
                            </p>

                        </div>
                    </div>

                    @*<div class="col-md-3 panel">    以后可以扩展留言板
                            <h3 class="panel-title">Follow me</h3>
                            <div class="panel-body">
                                <p class="follow-me-icons">
                                    <a href=""><i class="fa fa-twitter fa-2"></i></a>
                                    <a href=""><i class="fa fa-dribbble fa-2"></i></a>
                                    <a href=""><i class="fa fa-github fa-2"></i></a>
                                    <a href=""><i class="fa fa-facebook fa-2"></i></a>
                                    <a href=""><i class="fa fa-youtube fa-2"></i></a>
                                    <a href=""><i class="fa fa-pinterest fa-2"></i></a>
                                </p>
                            </div>
                        </div>*@

                </div>
                <!-- /row of panels -->
            </div>
        </div>

        <div class="footer2">
            <div class="container">
                <div class="row">

                    <div class="col-sm-6 panel">
                        <div class="panel-body">
                            <p class="text-right">
                                Copyright &copy; 2016.面试题库 All rights reserved.</a>
                            </p>
                        </div>
                    </div>

                </div>
                <!-- /row of panels -->
            </div>
        </div>

    </footer>










</body>

</html>

<script src="~/Scripts/jquery-1.8.2.min.js"></script>



<script type="text/javascript" language="javascript">
    function sub() {
        if ($("#message").val() != "")
        {
            $("#h").show();
        }
        else
        {
            alert("请您把题答完！！！")
        }
       


    }
        $("#Button1").click(function () {
            $(":checkbox").each(function(){
            $(this).attr("checked",!$(this).attr("checked"))
            
            })

        })
        function selectExcel() {
           
            var GUID = document.getElementsByName("check");

            var temp = "";

            var strGUID = "";

            for (var i = 0; i < GUID.length; i++) {

                if (GUID[i].checked) {

                    temp += GUID[i].value + ",";

                }

            }
            strGUID = temp


            //alert(strGUID);//测试取到的值是否正确
           
            //$("#GUID").val(strGUID);//将多选的值赋给Id为strGUID的隐藏域
            document.getElementById("strGUID").value = strGUID;
           
        }
      

</script>
<script type="text/javascript">

     function goTop() {
  
         $(window).scroll(function (e) {
      
                 //若滚动条离顶部大于100元素
       
                   if ($(window).scrollTop() > 100)
           
                         $("#gotop").fadeIn(1000);//以1秒的间隔渐显id=gotop的元素
           
                      else
            
                       $("#gotop").fadeOut(1000);//以1秒的间隔渐隐id=gotop的元素
          
               });
      
          };
    
     $(function () {
       
           //点击回到顶部的元素
       
            $("#gotop").click(function (e) {
         
                   //以1秒的间隔返回顶部
          
                  $('body,html').animate({ scrollTop: 0 }, 1000);
         
              });
    
            $("#gotop").mouseover(function (e) {
          
                    $(this).css("background", "url(~/img/1.png) no-repeat 0px 0px");
       
               });
       
               $("#gotop").mouseout(function (e) {
     
                  $(this).css("background", "url(img/1.png) no-repeat -70px 0px");
  
             });
   
          goTop();//实现回到顶部元素的渐显与渐隐
   
    });

</script>



